/**
 *  ward @ 2019
 *  harrydeep@wardyan.top
 */
package top.wardyan.po;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

import top.wardyan.base.config.Const;

/**
 * 
 * @author ward 2019年2月24日
 */
public class WLabel extends Label{
	
	/** 返回最右下角的那个点 **/
	protected Point bottom;

	/** 自定义的 Label**/
	public WLabel(Composite parent, Rectangle bound, String text) {
		this(parent, bound, Const.FONT_H6, text, SWT.LEFT);
	}
	
	/** 自定义的 Label**/
	public WLabel(Composite parent, Rectangle bound, Font font, String text) {
		this(parent, bound, font, text, SWT.LEFT);
	}
	
	/** 自定义的 Label**/
	public WLabel(Composite parent, Rectangle bound, String text, Integer align) {
		this(parent, bound, Const.FONT_H6, text, align);
	}
	
	/** 自定义的 Label**/
	public WLabel(Composite parent, Rectangle bound, Font font, String text, Integer align) {
		super(parent, SWT.NONE);
		this.setFont(font);
		this.setBackground(Const.COLOR_WHITE);
		this.setAlignment(align);
		this.setBounds(bound);
		this.setText(text);
		this.setBottom();
	}

	/** 取得控件的最右下角的那个点 **/
	public Point getBottom() {
		return this.bottom;
	}
	
	protected void setBottom() {
		this.bottom = new Point(this.getLocation().x + this.getSize().x, this.getLocation().y + this.getSize().y);
	}

	@Override
	protected void checkSubclass() {}

}
